extends "../haiwangxing-1/haiwangxing-1.gd"

func _extInit():
	._extInit()
	lv = 2
	addSkill("炮击锁定血量最低的队友，不再造成伤害，而是为其恢复等额的血量", "战斗辅助")
var p2 = 1
func setAiCha(cha):
	aiCha = getFirstCha(2, "sortByDistance")
	$ui / Label.text = "%s|%s" % [name, aiCha.name]

func normalAtkChara(cha):
	var chas = getAllChas(2)
	chas.sort_custom(sys, "sortByHp")

	for i in range(1):
		if i >= chas.size():break
		.normalAtkChara(chas[i])

func _onAtkChara(atkInfo):
	._onAtkChara(atkInfo)
	if atkInfo.hitCha.team == team:
		atkInfo.virtual = true

	if atkInfo.atkType == Chara.AtkType.MISS || atkInfo.isMiss:
		atkInfo.isMiss = false

	if atkInfo.atkType == sys.AtkType.GUN:
		if atkInfo.hitCha.team == team:
			healCha(atkInfo.hitCha, atkInfo.atkVal*p2)